<template>
  <div class="Slide">
    <div class="title">
      精选企业
    <div class="btns">
      <div class="swiper-button-prev prev" >
        <img src="~assets/images/newleft.png" alt="">
      </div>
      <div class="swiper-button-next next" >
        <img src="~assets/images/newright.png" alt="">
      </div>
    </div>
    </div>
    <div class="slide-box">
      <div class="pic-box">
       <swiper ref="hits" class="swiper" :options="swiperOption">
         <swiper-slide class="pic-item" v-for="(item,index) in merchant" :key="index">
          <router-link :to="{ name: 'CompanyHomeHome', params: { id: item.mer_id } }">
            <div class="mask">
                <span>{{item.mer_info}}</span>
              <p>{{item.mer_name}}</p>
            </div>
            <img :src="item.mer_avatar" :alt="item.mer_name" class="objectCover">
          </router-link>
         </swiper-slide>
       </swiper>
      </div>
    </div>
  </div>
</template>

<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'

export default {
  name:"Slide",
  components: {
    swiper,
    swiperSlide
  },
  props:{
	  merchant: []
  },
  data(){
    return{
      swiperOption: {
        autoplay: true,
        slidesPerView: 5,
        spaceBetween : 8,
        direction: 'horizontal',
        navigation: {
          nextEl: '.next',
          prevEl: '.prev'
        }
      }
    }
  },
  methods:{
    // prevClick(){
    //   this.$refs.hits.$swiper.slidePrev();
    // },
    // nextClick(){
    //   this.$refs.hits.$swiper.slideNext();
    // }
  }
}
</script>

<style scoped>

.Slide{
  margin-top: 30px;
}
.title{
  position: relative;
  padding-left: 16px;
  color: #777777;
  font-size: 18px;
}
.title::before{
  content:'';
  position: absolute;
  top: 4px;
  left: 0;
  height: 20px;
  width: 7px;
  background: #777777;
  border-radius: 2.5px;
}
.slide-box {
  position: relative;
}

.slide-box .pic-box .swiper{
  margin: 30px 0 50px;
}
.slide-box .pic-box .swiper .pic-item{
  height: 115px;
}
.slide-box .pic-box .swiper .pic-item a{
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
}
.slide-box .prev,.slide-box .next{
  position: absolute;
  top:50%;
  transform: translateY(-50%);
  background: #e48b2c;
  padding:16px 4px 13px 6px;
  z-index: 70;
  outline: none;
}

.slide-box .prev{
  left:0;
}
.slide-box .next{
  right:0;
}
@media only screen and (max-width:1200px)  {
  .panel-content{
    padding: 50px 20px;
  }
  .panel-content .item .pic-box{
	  height: 167px;
  }
  .Slide{
	  margin-top: 40px;
  }
  .slide-box .pic-box .swiper{
	  margin: 30px 0 50px;
  }
}

.btns {
  width: 50px;
  height: 20px;
  display: flex;
  position: absolute;
  top: 10px;
  right: 0;
}

.next {
  width: 31px;
  height: 31px;
  border-radius: 31px;
  color: #fff;
  background: none;
  line-height: 31px;
  text-align: center;
  cursor: pointer;
  outline: none
}

.prev {
  width: 31px;
  height: 31px;
  border-radius: 31px;
  color: #fff;
  background: none;
  line-height: 31px;
  text-align: center;
  cursor: pointer;
  outline: none;
  position: absolute;
  margin-right: 10px;
  left: -20px;
}

.prev img {
  width: 40px;
}

.next img {
  width: 40px;
}

.mask {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,.65);
  color: #fff;
  padding: 20px 30px 0px;
  opacity: 0;
  transform: translateZ(0);
  transition: opacity 500ms ease;
}

.mask span {
  display: inline-block;
  padding: 0 5px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.mask p {
  margin-top: 5px;
}

.mask:hover {
  opacity: 1;
}
</style>
